#!/usr/bin/env python 
# -*- coding:utf-8 -*-

#登录检测
def lgoin_check(user_id, pswd):
    flag = False
    f = open('data/user.txt')
    while True:
        user = f.readline()[:-1]
        print(user)
        if user == "":
            break
        password = f.readline()[:-1]
        print(password)
        if user_id == user and password == pswd:
            flag = True
    f.close()
    return flag

#注册检测
def register(user_id, pswd):
    # conn = database.connn()
    # cursor = conn.cursor(as_dict=True)
    # sql = """insert into users value('%s','%s')""" % (user_id, pswd)
    # sql = 'insert into users values (\'' + user_id + '\',' + pswd + ');COMMIT'
    # cursor.execute(sql)
    # conn.close()
    f = open('data/user.txt','a')
    f.write(user_id +'\n'+ pswd +'\n')
    f.write(user_id)
    f.close()
    return True